<%@ page contentType="text/html;charset=UTF-8" %>
<%@ page import="cn.lightpm.util.security.SpringSecurityUtils" %>
<%@ include file="/jsp/common/taglibs.jsp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>角色管理</title>
	<%@ include file="/jsp/common/meta.jsp" %>
	<link href="${ctx}/resources/css/yui.css" type="text/css" rel="stylesheet"/>
	<link href="${ctx}/resources/css/style.css" type="text/css" rel="stylesheet"/>
	<script src="${ctx}/resources/js/jquery.js" type="text/javascript"></script>
	<script src="${ctx}/resources/js/table.js" type="text/javascript"></script>
	
<script>
function deleteRole(id){
	if(confirm('请确认是否删除！')){
		   $.ajax({
		    url:'/lightpm/role/'+id,
		    type: 'DELETE',
		    success: function(){
		    	$('#'+id+'_tr').remove();
		    }
		   });
		  }
	
}
</script>
</head>

<body>
<div id="doc3">
<%@ include file="/jsp/common/header.jsp" %>
<div id="bd">
	<div id="yui-main">
	<div class="yui-b">

	<div id="filter">你好, <%=SpringSecurityUtils.getCurrentUserName()%>.</div>

	<div id="content">
		<table id="contentTable">
			<tr>
				<th>名称</th>
				<th>授权</th>
				<th>操作</th>
			</tr>

			<c:forEach items="${roles}" var="role">
				<tr id="${role.id}_tr">
					<td>${role.name}</td>
					<td>${role.authNames}</td>
					<td>&nbsp;
							<input type="button" value="修改" onclick="javascript:window.location.href='/lightpm/role/${role.id}/edit'" />&nbsp;
							<input type="button" value="删除" onclick="deleteRole(${role.id});" />
						</td>
				</tr>
			</c:forEach>
		</table>
	</div>

	<div>
		<a href="/lightpm/role/new">增加新角色</a>
	</div>
	</div>
	</div>
</div>
<%@ include file="/jsp/common/footer.jsp" %>
</div>
</body>
</html>
